package com.byxy.shop.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.byxy.shop.service.GoodsDetailService;
import com.byxy.ssm.shop.vo.GoodsDetailVO;

@Controller
@RequestMapping("/goods")
public class GoodsDetailController {
	
	@Autowired
	private GoodsDetailService goodsDetailService;
	
	/** 根据商品Id显示 */
	@GetMapping("/detail/{goodsId}")
	public String detail(@PathVariable("goodsId") Integer goodsId,Model model) {
		// 获取地址Id
		GoodsDetailVO goodsDetail = goodsDetailService.getByGoodsId(goodsId);
		model.addAttribute("goodsDetail", goodsDetail);
		return "mall/detail";

	}
}
